
package com.huk.chengka.ckf.web;

import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.RandomUtil;
import com.huk.chengka.ckf.service.FindCardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;


@Controller
@RequestMapping("/find")
public class FindController {

    @Autowired
    private FindCardService findCardService;

    @GetMapping("/specifiedCount/{count}")
    @ResponseBody
    public String hello(@PathVariable("count") Integer count) {
        List<String> cardList = new ArrayList<>();
        for (int i = 0; i < count; i++) {
            cardList.add(RandomUtil.randomString(16).toUpperCase());
        }
        ThreadUtil.execAsync(() -> findCardService.find(cardList), false);
        return "ok";
    }



}
